<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>兴趣交友 - 发现志同道合的朋友</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #4f46e5;
            --primary-light: #818cf8;
            --primary-dark: #3730a3;
            --secondary: #ec4899;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --bg-light: #f8fafc;
            --bg-white: #ffffff;
            --border-light: #e2e8f0;
            --radius: 12px;
            --shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            --transition: all 0.3s ease;
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 70px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
        }
        
        .nav-title {
            font-size: 1.15rem;
            font-weight: 600;
            text-align: center;
            flex: 1;
        }
        
        .nav-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: var(--transition);
        }
        
        .nav-btn:hover {
            background-color: var(--bg-light);
            color: var(--primary);
        }
        
        /* 搜索与筛选区 */
        .search-filter-container {
            background-color: var(--bg-white);
            padding: 12px 16px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .search-box {
            position: relative;
            margin-bottom: 12px;
        }
        
        .search-input {
            width: 100%;
            padding: 10px 16px 10px 40px;
            border: 1px solid var(--border-light);
            border-radius: 8px;
            font-size: 0.9rem;
            background-color: var(--bg-light);
            transition: var(--transition);
        }
        
        .search-input:focus {
            outline: none;
            border-color: var(--primary-light);
            box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1);
        }
        
        .search-icon {
            position: absolute;
            left: 14px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--text-secondary);
        }
        
        /* 快速筛选栏 */
        .quick-filters {
            display: flex;
            gap: 8px;
            overflow-x: auto;
            padding-bottom: 4px;
            scrollbar-width: none;
        }
        
        .quick-filters::-webkit-scrollbar {
            display: none;
        }
        
        .quick-filter-btn {
            white-space: nowrap;
            padding: 6px 12px;
            background-color: var(--bg-light);
            border: 1px solid var(--border-light);
            border-radius: 20px;
            font-size: 0.85rem;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            gap: 4px;
            transition: var(--transition);
        }
        
        .quick-filter-btn:hover, .quick-filter-btn.active {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        /* 高级筛选面板触发器 */
        .advanced-filter-trigger {
            width: 100%;
            padding: 8px 12px;
            background-color: var(--bg-light);
            border: 1px solid var(--border-light);
            border-radius: 8px;
            font-size: 0.9rem;
            color: var(--text-secondary);
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: 8px;
        }
        
        /* 兴趣分类标签 */
        .interest-categories {
            padding: 12px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            overflow-x: auto;
            scrollbar-width: none;
        }
        
        .interest-categories::-webkit-scrollbar {
            display: none;
        }
        
        .categories-container {
            display: flex;
            gap: 10px;
            white-space: nowrap;
        }
        
        .category-tag {
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 0.85rem;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            transition: var(--transition);
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        
        .category-tag.active {
            background-color: var(--primary);
            color: white;
        }
        
        .category-tag:hover:not(.active) {
            background-color: #e2e8f0;
        }
        
        /* 高级筛选面板 */
        .advanced-filter-panel {
            position: fixed;
            top: 56px;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: var(--bg-white);
            z-index: 1010;
            transform: translateY(100%);
            transition: transform 0.3s ease;
            display: flex;
            flex-direction: column;
        }
        
        .advanced-filter-panel.active {
            transform: translateY(0);
        }
        
        .filter-panel-header {
            padding: 16px;
            border-bottom: 1px solid var(--border-light);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .filter-panel-title {
            font-size: 1.1rem;
            font-weight: 600;
        }
        
        .filter-panel-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            font-size: 1.2rem;
        }
        
        .filter-content {
            flex: 1;
            overflow-y: auto;
            padding: 16px;
        }
        
        .filter-section {
            margin-bottom: 24px;
        }
        
        .filter-section-title {
            font-size: 0.95rem;
            font-weight: 600;
            margin-bottom: 12px;
            color: var(--text-primary);
        }
        
        .filter-options {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
        }
        
        .filter-option {
            padding: 6px 14px;
            border-radius: 20px;
            font-size: 0.85rem;
            background-color: var(--bg-light);
            color: var(--text-secondary);
            border: 1px solid var(--border-light);
            transition: var(--transition);
            cursor: pointer;
        }
        
        .filter-option.active {
            background-color: var(--primary);
            color: white;
            border-color: var(--primary);
        }
        
        /* 范围滑块筛选 */
        .range-filter {
            padding: 10px 0;
        }
        
        .range-labels {
            display: flex;
            justify-content: space-between;
            margin-bottom: 8px;
            font-size: 0.8rem;
            color: var(--text-secondary);
        }
        
        .range-slider {
            width: 100%;
            accent-color: var(--primary);
        }
        
        /* 筛选操作栏 */
        .filter-actions {
            padding: 16px;
            border-top: 1px solid var(--border-light);
            display: flex;
            gap: 12px;
        }
        
        .reset-filters {
            flex: 1;
            padding: 10px 0;
            background-color: var(--bg-light);
            border: 1px solid var(--border-light);
            border-radius: 8px;
            font-size: 0.9rem;
            color: var(--text-secondary);
            transition: var(--transition);
        }
        
        .apply-filters {
            flex: 1;
            padding: 10px 0;
            background-color: var(--primary);
            border: none;
            border-radius: 8px;
            font-size: 0.9rem;
            color: white;
            transition: var(--transition);
        }
        
        /* 筛选标签展示区 */
        .active-filters {
            padding: 8px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }
        
        .active-filter-tag {
            padding: 4px 10px;
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
            border-radius: 16px;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        
        .remove-filter {
            background: none;
            border: none;
            color: var(--primary);
            cursor: pointer;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .clear-all-filters {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-left: auto;
            cursor: pointer;
        }
        
        /* 交友列表 */
        .friends-list {
            padding: 12px 16px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        
        /* 交友项样式 */
        .friend-item {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: var(--transition);
        }
        
        .friend-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
        }
        
        .friend-item.no-images .friend-content {
            padding: 16px;
        }
        
        /* 内容容器 */
        .friend-content {
            display: flex;
            gap: 12px;
            padding: 16px;
        }
        
        /* 用户头像 */
        .user-avatar {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            overflow: hidden;
            flex-shrink: 0;
            border: 2px solid var(--bg-light);
        }
        
        .user-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        /* 用户信息 */
        .user-info {
            flex: 1;
            min-width: 0;
        }
        
        .user-name {
            font-size: 1.05rem;
            font-weight: 600;
            margin-bottom: 4px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        
        .user-age {
            font-size: 0.85rem;
            color: var(--text-secondary);
            background-color: var(--bg-light);
            padding: 1px 8px;
            border-radius: 10px;
        }
        
        .user-location {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-bottom: 6px;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .user-interests {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 8px;
        }
        
        .interest-tag {
            padding: 2px 8px;
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
            font-size: 0.75rem;
            border-radius: 4px;
        }
        
        .user-bio {
            font-size: 0.85rem;
            color: var(--text-secondary);
            line-height: 1.4;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            margin-bottom: 8px;
        }
        
        /* 图片容器 */
        .images-container {
            width: 100%;
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 2px;
        }
        
        .image-item {
            aspect-ratio: 1;
            overflow: hidden;
        }
        
        .image-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: var(--transition);
        }
        
        /* 互动按钮 */
        .interaction-buttons {
            display: flex;
            gap: 10px;
            margin-top: 8px;
        }
        
        .interact-btn {
            padding: 6px 12px;
            border-radius: 6px;
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            transition: var(--transition);
            border: none;
        }
        
        .message-btn {
            flex: 1;
            background-color: var(--primary);
            color: white;
        }
        
        .like-btn {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background-color: var(--bg-light);
            color: var(--text-secondary);
        }
        
        .like-btn:hover, .like-btn.liked {
            background-color: #fee2e2;
            color: #ef4444;
        }
        
        /* 加载更多 */
        .load-more {
            margin: 16px 0;
            padding: 12px;
            text-align: center;
            color: var(--primary);
            font-size: 0.9rem;
            background-color: var(--bg-white);
            border-radius: var(--radius);
            border: 1px solid var(--border-light);
            transition: var(--transition);
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 65px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            text-decoration: none;
        }
        
        .nav-item i {
            font-size: 1.25rem;
            margin-bottom: 4px;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        /* 空状态 */
        .empty-state {
            padding: 60px 20px;
            text-align: center;
            color: var(--text-secondary);
        }
        
        .empty-state i {
            font-size: 3rem;
            margin-bottom: 16px;
            color: var(--border-light);
        }
        
        /* 在线状态 */
        .online-indicator {
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background-color: #10b981;
            border: 2px solid white;
            position: absolute;
            bottom: 0;
            right: 0;
        }
        
        .avatar-container {
            position: relative;
        }
        
        /* 遮罩层 */
        .overlay {
            position: fixed;
            top: 56px;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1005;
            display: none;
        }
        
        .overlay.active {
            display: block;
        }
        
        /* 筛选结果计数 */
        .results-count {
            padding: 8px 16px;
            font-size: 0.85rem;
            color: var(--text-secondary);
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-btn" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">兴趣交友</div>
        <button class="nav-btn" id="settingsBtn">
            <i class="fas fa-cog"></i>
        </button>
    </div>
    
    <!-- 搜索与快速筛选区 -->
    <div class="search-filter-container">
        <div class="search-box">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索兴趣、用户名或标签...">
        </div>
        
        <div class="quick-filters">
            <button class="quick-filter-btn active">
                <i class="fas fa-users"></i>
                <span>全部</span>
            </button>
            <button class="quick-filter-btn">
                <i class="fas fa-map-marker-alt"></i>
                <span>附近</span>
            </button>
            <button class="quick-filter-btn">
                <i class="fas fa-clock"></i>
                <span>最新</span>
            </button>
            <button class="quick-filter-btn">
                <i class="fas fa-circle"></i>
                <span>在线</span>
            </button>
            <button class="quick-filter-btn">
                <i class="fas fa-star"></i>
                <span>热门</span>
            </button>
        </div>
        
        <button class="advanced-filter-trigger" id="advancedFilterTrigger">
            <i class="fas fa-sliders-h"></i>
            <span>高级筛选</span>
            <i class="fas fa-chevron-down"></i>
        </button>
    </div>
    
    <!-- 兴趣分类标签 -->
    <div class="interest-categories">
        <div class="categories-container">
            <div class="category-tag active">
                <i class="fas fa-th"></i>
                <span>全部兴趣</span>
            </div>
            <div class="category-tag">
                <i class="fas fa-book"></i>
                <span>阅读</span>
            </div>
            <div class="category-tag">
                <i class="fas fa-music"></i>
                <span>音乐</span>
            </div>
            <div class="category-tag">
                <i class="fas fa-film"></i>
                <span>电影</span>
            </div>
            <div class="category-tag">
                <i class="fas fa-hiking"></i>
                <span>运动</span>
            </div>
            <div class="category-tag">
                <i class="fas fa-paint-brush"></i>
                <span>艺术</span>
            </div>
            <div class="category-tag">
                <i class="fas fa-gamepad"></i>
                <span>游戏</span>
            </div>
            <div class="category-tag">
                <i class="fas fa-utensils"></i>
                <span>美食</span>
            </div>
            <div class="category-tag">
                <i class="fas fa-plane"></i>
                <span>旅行</span>
            </div>
        </div>
    </div>
    
    <!-- 活跃筛选标签展示区 -->
    <div class="active-filters" id="activeFilters">
        <!-- 筛选标签会动态添加到这里 -->
        <div class="clear-all-filters" style="display: none;">
            清除全部
        </div>
    </div>
    
    <!-- 筛选结果计数 -->
    <div class="results-count" id="resultsCount">
        找到 24 位符合条件的用户
    </div>
    
    <!-- 高级筛选面板 -->
    <div class="advanced-filter-panel" id="advancedFilterPanel">
        <div class="filter-panel-header">
            <div class="filter-panel-title">高级筛选</div>
            <button class="filter-panel-close" id="closeFilterPanel">
                <i class="fas fa-times"></i>
            </button>
        </div>
        
        <div class="filter-content">
            <div class="filter-section">
                <div class="filter-section-title">年龄范围</div>
                <div class="filter-options">
                    <div class="filter-option active">全部</div>
                    <div class="filter-option">18-22岁</div>
                    <div class="filter-option">23-28岁</div>
                    <div class="filter-option">29-35岁</div>
                    <div class="filter-option">36-45岁</div>
                    <div class="filter-option">45岁以上</div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="filter-section-title">距离范围</div>
                <div class="range-filter">
                    <div class="range-labels">
                        <span>1公里</span>
                        <span id="distanceValue">20公里</span>
                        <span>100公里</span>
                    </div>
                    <input type="range" class="range-slider" min="1" max="100" value="20" id="distanceSlider">
                </div>
            </div>
            
            <div class="filter-section">
                <div class="filter-section-title">性别</div>
                <div class="filter-options">
                    <div class="filter-option active">不限</div>
                    <div class="filter-option">男</div>
                    <div class="filter-option">女</div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="filter-section-title">活跃时间</div>
                <div class="filter-options">
                    <div class="filter-option active">全部</div>
                    <div class="filter-option">今天</div>
                    <div class="filter-option">本周</div>
                    <div class="filter-option">本月</div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="filter-section-title">个性标签</div>
                <div class="filter-options">
                    <div class="filter-option">开朗</div>
                    <div class="filter-option">内向</div>
                    <div class="filter-option">幽默</div>
                    <div class="filter-option">文艺</div>
                    <div class="filter-option">冒险</div>
                    <div class="filter-option">宅家</div>
                    <div class="filter-option">学霸</div>
                    <div class="filter-option">创业</div>
                </div>
            </div>
            
            <div class="filter-section">
                <div class="filter-section-title">是否有照片</div>
                <div class="filter-options">
                    <div class="filter-option active">不限</div>
                    <div class="filter-option">有照片</div>
                    <div class="filter-option">无照片</div>
                </div>
            </div>
        </div>
        
        <div class="filter-actions">
            <button class="reset-filters" id="resetFilters">重置</button>
            <button class="apply-filters" id="applyFilters">应用筛选</button>
        </div>
    </div>
    
    <!-- 遮罩层 -->
    <div class="overlay" id="overlay"></div>
    
    <!-- 交友列表 -->
    <div class="friends-list" id="friendsList">
        <!-- 无图交友项 -->
        <div class="friend-item no-images">
            <div class="friend-content">
                <div class="avatar-container">
                    <div class="user-avatar">
                        <img src="https://picsum.photos/id/64/100/100" alt="用户头像">
                    </div>
                    <div class="online-indicator"></div>
                </div>
                <div class="user-info">
                    <div class="user-name">
                        星辰大海
                        <span class="user-age">26岁</span>
                    </div>
                    <div class="user-location">
                        <i class="fas fa-map-marker-alt"></i>
                        <span>距离 1.2 公里</span>
                    </div>
                    <div class="user-interests">
                        <span class="interest-tag">科幻小说</span>
                        <span class="interest-tag">天文</span>
                        <span class="interest-tag">摄影</span>
                    </div>
                    <div class="user-bio">
                        天文爱好者，周末经常去郊外观星，希望认识同样对宇宙充满好奇的朋友。
                    </div>
                    <div class="interaction-buttons">
                        <button class="interact-btn message-btn">
                            <i class="fas fa-comment"></i>
                            <span>聊天</span>
                        </button>
                        <button class="interact-btn like-btn">
                            <i class="far fa-heart"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 单图交友项 -->
        <div class="friend-item">
            <div class="friend-content">
                <div class="avatar-container">
                    <div class="user-avatar">
                        <img src="https://picsum.photos/id/65/100/100" alt="用户头像">
                    </div>
                </div>
                <div class="user-info">
                    <div class="user-name">
                        夏日清风
                        <span class="user-age">23岁</span>
                    </div>
                    <div class="user-location">
                        <i class="fas fa-map-marker-alt"></i>
                        <span>距离 3.5 公里</span>
                    </div>
                    <div class="user-interests">
                        <span class="interest-tag">徒步</span>
                        <span class="interest-tag">露营</span>
                        <span class="interest-tag">自然</span>
                    </div>
                    <div class="user-bio">
                        喜欢亲近自然，每个月都会组织一次徒步活动，欢迎加入我们的户外小组！
                    </div>
                </div>
            </div>
            <div class="images-container">
                <div class="image-item">
                    <img src="https://picsum.photos/id/29/300/300" alt="用户分享的图片">
                </div>
                <div class="image-item" style="display: none;"></div>
                <div class="image-item" style="display: none;"></div>
            </div>
            <div class="friend-content" style="padding-top: 0; padding-bottom: 16px;">
                <div class="user-avatar" style="visibility: hidden;"></div>
                <div class="user-info">
                    <div class="interaction-buttons">
                        <button class="interact-btn message-btn">
                            <i class="fas fa-comment"></i>
                            <span>聊天</span>
                        </button>
                        <button class="interact-btn like-btn">
                            <i class="far fa-heart"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 三图交友项 -->
        <div class="friend-item">
            <div class="friend-content">
                <div class="avatar-container">
                    <div class="user-avatar">
                        <img src="https://picsum.photos/id/91/100/100" alt="用户头像">
                    </div>
                    <div class="online-indicator"></div>
                </div>
                <div class="user-info">
                    <div class="user-name">
                        咖啡不加糖
                        <span class="user-age">31岁</span>
                    </div>
                    <div class="user-location">
                        <i class="fas fa-map-marker-alt"></i>
                        <span>距离 5.8 公里</span>
                    </div>
                    <div class="user-interests">
                        <span class="interest-tag">咖啡</span>
                        <span class="interest-tag">烘焙</span>
                        <span class="interest-tag">阅读</span>
                    </div>
                    <div class="user-bio">
                        咖啡师一枚，喜欢研究各种咖啡配方，偶尔烘焙面包，寻找可以一起品尝咖啡的朋友。
                    </div>
                </div>
            </div>
            <div class="images-container">
                <div class="image-item">
                    <img src="https://picsum.photos/id/431/300/300" alt="用户分享的图片">
                </div>
                <div class="image-item">
                    <img src="https://picsum.photos/id/225/300/300" alt="用户分享的图片">
                </div>
                <div class="image-item">
                    <img src="https://picsum.photos/id/425/300/300" alt="用户分享的图片">
                </div>
            </div>
            <div class="friend-content" style="padding-top: 0; padding-bottom: 16px;">
                <div class="user-avatar" style="visibility: hidden;"></div>
                <div class="user-info">
                    <div class="interaction-buttons">
                        <button class="interact-btn message-btn">
                            <i class="fas fa-comment"></i>
                            <span>聊天</span>
                        </button>
                        <button class="interact-btn like-btn">
                            <i class="far fa-heart"></i>
                        </button>
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 加载更多 -->
        <div class="load-more" id="loadMore">
            加载更多
        </div>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-heart"></i>
            <span>交友</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-comment"></i>
            <span>消息</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById("backBtn");
        const settingsBtn = document.getElementById("settingsBtn");
        const advancedFilterTrigger = document.getElementById("advancedFilterTrigger");
        const advancedFilterPanel = document.getElementById("advancedFilterPanel");
        const closeFilterPanel = document.getElementById("closeFilterPanel");
        const overlay = document.getElementById("overlay");
        const resetFilters = document.getElementById("resetFilters");
        const applyFiltersBtn = document.getElementById("applyFilters");
        const quickFilterBtns = document.querySelectorAll(".quick-filter-btn");
        const categoryTags = document.querySelectorAll(".category-tag");
        const loadMoreBtn = document.getElementById("loadMore");
        const friendsList = document.getElementById("friendsList");
        const searchInput = document.querySelector(".search-input");
        const activeFiltersContainer = document.getElementById("activeFilters");
        const clearAllFilters = document.querySelector(".clear-all-filters");
        const distanceSlider = document.getElementById("distanceSlider");
        const distanceValue = document.getElementById("distanceValue");
        const resultsCount = document.getElementById("resultsCount");
        
        // 所有用户数据
        const allUsers = [
            {
                id: 1,
                name: "星辰大海",
                age: 26,
                avatar: "https://picsum.photos/id/64/100/100",
                location: "距离 1.2 公里",
                distance: 1.2,
                interests: ["科幻小说", "天文", "摄影"],
                bio: "天文爱好者，周末经常去郊外观星，希望认识同样对宇宙充满好奇的朋友。",
                images: [],
                online: true,
                gender: "男",
                lastActive: "今天",
                tags: ["文艺", "探索"]
            },
            {
                id: 2,
                name: "夏日清风",
                age: 23,
                avatar: "https://picsum.photos/id/65/100/100",
                location: "距离 3.5 公里",
                distance: 3.5,
                interests: ["徒步", "露营", "自然"],
                bio: "喜欢亲近自然，每个月都会组织一次徒步活动，欢迎加入我们的户外小组！",
                images: ["https://picsum.photos/id/29/300/300"],
                online: false,
                gender: "女",
                lastActive: "昨天",
                tags: ["冒险", "开朗"]
            },
            {
                id: 3,
                name: "咖啡不加糖",
                age: 31,
                avatar: "https://picsum.photos/id/91/100/100",
                location: "距离 5.8 公里",
                distance: 5.8,
                interests: ["咖啡", "烘焙", "阅读"],
                bio: "咖啡师一枚，喜欢研究各种咖啡配方，偶尔烘焙面包，寻找可以一起品尝咖啡的朋友。",
                images: [
                    "https://picsum.photos/id/431/300/300",
                    "https://picsum.photos/id/225/300/300",
                    "https://picsum.photos/id/425/300/300"
                ],
                online: true,
                gender: "女",
                lastActive: "今天",
                tags: ["文艺", "宅家"]
            },
            {
                id: 4,
                name: "音乐漫游者",
                age: 28,
                avatar: "https://picsum.photos/id/237/100/100",
                location: "距离 8.3 公里",
                distance: 8.3,
                interests: ["独立音乐", "Livehouse", "吉他"],
                bio: "独立音乐爱好者，周末经常去看演出，自己也在学吉他，希望认识同样喜欢音乐的朋友。",
                images: [
                    "https://picsum.photos/id/1082/300/300",
                    "https://picsum.photos/id/1074/300/300"
                ],
                online: false,
                gender: "男",
                lastActive: "本周",
                tags: ["幽默", "开朗"]
            },
            {
                id: 5,
                name: "书香门第",
                age: 35,
                avatar: "https://picsum.photos/id/177/100/100",
                location: "距离 2.7 公里",
                distance: 2.7,
                interests: ["文学", "历史", "书法"],
                bio: "大学文学老师，喜欢收集古籍，每周六在图书馆有读书会，欢迎参加。",
                images: [],
                online: false,
                gender: "男",
                lastActive: "本月",
                tags: ["学霸", "内向"]
            },
            {
                id: 6,
                name: "篮球小子",
                age: 22,
                avatar: "https://picsum.photos/id/338/100/100",
                location: "距离 4.2 公里",
                distance: 4.2,
                interests: ["篮球", "健身", "电竞"],
                bio: "篮球爱好者，每天晚上都会去球场，寻找固定队友组建球队。",
                images: [
                    "https://picsum.photos/id/1058/300/300"
                ],
                online: true,
                gender: "男",
                lastActive: "今天",
                tags: ["开朗", "冒险"]
            },
            {
                id: 7,
                name: "美食家",
                age: 30,
                avatar: "https://picsum.photos/id/453/100/100",
                location: "距离 6.5 公里",
                distance: 6.5,
                interests: ["美食", "烹饪", "探店"],
                bio: "喜欢尝试各种美食，自己也喜欢下厨，有一个美食分享小组，欢迎加入。",
                images: [
                    "https://picsum.photos/id/292/300/300",
                    "https://picsum.photos/id/431/300/300"
                ],
                online: false,
                gender: "女",
                lastActive: "昨天",
                tags: ["开朗", "幽默"]
            }
        ];
        
        // 当前显示的用户
        let displayedUsers = [...allUsers];
        
        // 当前筛选条件
        const currentFilters = {
            quickFilter: "全部",
            category: "全部兴趣",
            age: "全部",
            distance: 20,
            gender: "不限",
            activity: "全部",
            personality: [],
            hasPhotos: "不限",
            search: ""
        };
        
        // 初始化
        function init() {
            setupEventListeners();
            renderUserList(displayedUsers);
        }
        
        // 设置事件监听
        function setupEventListeners() {
            // 返回按钮
            backBtn.addEventListener("click", () => {
                history.back();
            });
            
            // 设置按钮
            settingsBtn.addEventListener("click", () => {
                alert("打开设置页面");
            });
            
            // 高级筛选面板开关
            advancedFilterTrigger.addEventListener("click", toggleAdvancedFilterPanel);
            
            // 关闭筛选面板
            closeFilterPanel.addEventListener("click", closeAdvancedFilterPanel);
            
            // 遮罩层点击关闭筛选面板
            overlay.addEventListener("click", closeAdvancedFilterPanel);
            
            // 快速筛选按钮
            quickFilterBtns.forEach(btn => {
                btn.addEventListener("click", function() {
                    const filterType = this.querySelector("span").textContent;
                    
                    // 更新按钮状态
                    quickFilterBtns.forEach(b => b.classList.remove("active"));
                    this.classList.add("active");
                    
                    // 更新筛选条件
                    currentFilters.quickFilter = filterType;
                    
                    // 应用筛选
                    applyAllFilters();
                    updateActiveFiltersDisplay();
                });
            });
            
            // 兴趣分类标签点击
            categoryTags.forEach(tag => {
                tag.addEventListener("click", function() {
                    // 移除其他标签的活跃状态
                    categoryTags.forEach(t => t.classList.remove("active"));
                    // 添加当前标签的活跃状态
                    this.classList.add("active");
                    
                    // 更新筛选条件
                    currentFilters.category = this.querySelector("span").textContent;
                    
                    // 应用筛选
                    applyAllFilters();
                    updateActiveFiltersDisplay();
                });
            });
            
            // 筛选选项点击
            document.querySelectorAll(".filter-option").forEach(option => {
                option.addEventListener("click", function() {
                    const section = this.closest(".filter-section");
                    const sectionTitle = section.querySelector(".filter-section-title").textContent;
                    
                    // 移除同组其他选项的活跃状态
                    const siblings = section.querySelectorAll(".filter-option");
                    siblings.forEach(opt => opt.classList.remove("active"));
                    
                    // 对于个性标签，允许多选
                    if (sectionTitle === "个性标签") {
                        this.classList.toggle("active");
                    } else {
                        // 添加当前选项的活跃状态
                        this.classList.add("active");
                    }
                });
            });
            
            // 距离滑块
            distanceSlider.addEventListener("input", function() {
                const value = this.value;
                distanceValue.textContent = `${value}公里`;
                currentFilters.distance = parseInt(value);
            });
            
            // 应用筛选
            applyFiltersBtn.addEventListener("click", function() {
                // 收集筛选条件
                const sections = document.querySelectorAll(".filter-section");
                
                sections.forEach(section => {
                    const title = section.querySelector(".filter-section-title").textContent;
                    const activeOptions = section.querySelectorAll(".filter-option.active");
                    
                    switch(title) {
                        case "年龄范围":
                            currentFilters.age = activeOptions[0].textContent;
                            break;
                        case "性别":
                            currentFilters.gender = activeOptions[0].textContent;
                            break;
                        case "活跃时间":
                            currentFilters.activity = activeOptions[0].textContent;
                            break;
                        case "个性标签":
                            currentFilters.personality = Array.from(activeOptions).map(opt => opt.textContent);
                            break;
                        case "是否有照片":
                            currentFilters.hasPhotos = activeOptions[0].textContent;
                            break;
                    }
                });
                
                closeAdvancedFilterPanel();
                applyAllFilters();
                updateActiveFiltersDisplay();
            });
            
            // 重置筛选
            resetFilters.addEventListener("click", function() {
                // 重置所有筛选选项
                document.querySelectorAll(".filter-section").forEach(section => {
                    const options = section.querySelectorAll(".filter-option");
                    options.forEach(opt => opt.classList.remove("active"));
                    options[0].classList.add("active");
                });
                
                // 重置距离滑块
                distanceSlider.value = 20;
                distanceValue.textContent = "20公里";
                currentFilters.distance = 20;
                
                // 重置个性标签数组
                currentFilters.personality = [];
            });
            
            // 清除所有筛选
            clearAllFilters.addEventListener("click", clearAllFiltersHandler);
            
            // 加载更多
            loadMoreBtn.addEventListener("click", loadMoreUsers);
            
            // 搜索功能
            searchInput.addEventListener("input", (e) => {
                const keyword = e.target.value.trim();
                currentFilters.search = keyword;
                
                // 延迟搜索，避免频繁触发
                clearTimeout(window.searchTimeout);
                window.searchTimeout = setTimeout(() => {
                    applyAllFilters();
                    updateActiveFiltersDisplay();
                }, 500);
            });
            
            // 点赞按钮点击
            document.addEventListener("click", (e) => {
                if (e.target.closest(".like-btn")) {
                    const likeBtn = e.target.closest(".like-btn");
                    const icon = likeBtn.querySelector("i");
                    
                    likeBtn.classList.toggle("liked");
                    
                    if (likeBtn.classList.contains("liked")) {
                        icon.classList.remove("far");
                        icon.classList.add("fas");
                        showToast("已喜欢");
                    } else {
                        icon.classList.remove("fas");
                        icon.classList.add("far");
                        showToast("取消喜欢");
                    }
                }
                
                // 聊天按钮点击
                if (e.target.closest(".message-btn")) {
                    const friendItem = e.target.closest(".friend-item");
                    const userName = friendItem.querySelector(".user-name").textContent.trim();
                    showToast(`开始与 ${userName} 聊天`);
                }
                
                // 图片点击
                if (e.target.closest(".image-item img")) {
                    const imgSrc = e.target.getAttribute("src");
                    showToast("查看大图");
                }
                
                // 移除单个筛选条件
                if (e.target.closest(".remove-filter")) {
                    const filterTag = e.target.closest(".active-filter-tag");
                    const filterText = filterTag.querySelector("span").textContent;
                    
                    removeFilter(filterText);
                    filterTag.remove();
                    
                    // 重新应用筛选
                    applyAllFilters();
                    updateActiveFiltersDisplay();
                }
            });
        }
        
        // 切换高级筛选面板
        function toggleAdvancedFilterPanel() {
            if (advancedFilterPanel.classList.contains("active")) {
                closeAdvancedFilterPanel();
            } else {
                openAdvancedFilterPanel();
            }
        }
        
        // 打开高级筛选面板
        function openAdvancedFilterPanel() {
            advancedFilterPanel.classList.add("active");
            overlay.classList.add("active");
            document.body.style.overflow = "hidden";
        }
        
        // 关闭高级筛选面板
        function closeAdvancedFilterPanel() {
            advancedFilterPanel.classList.remove("active");
            overlay.classList.remove("active");
            document.body.style.overflow = "auto";
        }
        
        // 应用所有筛选条件
        function applyAllFilters() {
            // 显示加载状态
            showLoading();
            
            // 模拟筛选延迟
            setTimeout(() => {
                let filteredUsers = [...allUsers];
                
                // 应用快速筛选
                if (currentFilters.quickFilter === "附近") {
                    filteredUsers = filteredUsers.sort((a, b) => a.distance - b.distance);
                } else if (currentFilters.quickFilter === "最新") {
                    // 简单的活跃时间排序
                    const activityOrder = { "今天": 3, "昨天": 2, "本周": 1, "本月": 0 };
                    filteredUsers = filteredUsers.sort((a, b) => 
                        activityOrder[b.lastActive] - activityOrder[a.lastActive]
                    );
                } else if (currentFilters.quickFilter === "在线") {
                    filteredUsers = filteredUsers.filter(user => user.online);
                } else if (currentFilters.quickFilter === "热门") {
                    // 这里简单按ID倒序模拟热门排序
                    filteredUsers = filteredUsers.sort((a, b) => b.id - a.id);
                }
                
                // 应用兴趣分类筛选
                if (currentFilters.category !== "全部兴趣") {
                    filteredUsers = filteredUsers.filter(user => 
                        user.interests.some(interest => interest.includes(currentFilters.category))
                    );
                }
                
                // 应用年龄筛选
                if (currentFilters.age !== "全部") {
                    const [minAge, maxAge] = currentFilters.age.includes("以上") 
                        ? [parseInt(currentFilters.age), 100]
                        : currentFilters.age.split("-").map(age => parseInt(age));
                    
                    filteredUsers = filteredUsers.filter(user => 
                        user.age >= minAge && user.age <= maxAge
                    );
                }
                
                // 应用距离筛选
                filteredUsers = filteredUsers.filter(user => 
                    user.distance <= currentFilters.distance
                );
                
                // 应用性别筛选
                if (currentFilters.gender !== "不限") {
                    filteredUsers = filteredUsers.filter(user => user.gender === currentFilters.gender);
                }
                
                // 应用活跃时间筛选
                if (currentFilters.activity !== "全部") {
                    filteredUsers = filteredUsers.filter(user => user.lastActive === currentFilters.activity);
                }
                
                // 应用个性标签筛选
                if (currentFilters.personality.length > 0) {
                    filteredUsers = filteredUsers.filter(user => 
                        currentFilters.personality.every(tag => user.tags.includes(tag))
                    );
                }
                
                // 应用照片筛选
                if (currentFilters.hasPhotos === "有照片") {
                    filteredUsers = filteredUsers.filter(user => user.images && user.images.length > 0);
                } else if (currentFilters.hasPhotos === "无照片") {
                    filteredUsers = filteredUsers.filter(user => !user.images || user.images.length === 0);
                }
                
                // 应用搜索筛选
                if (currentFilters.search) {
                    const keyword = currentFilters.search.toLowerCase();
                    filteredUsers = filteredUsers.filter(user => 
                        user.name.toLowerCase().includes(keyword) ||
                        user.interests.some(interest => interest.toLowerCase().includes(keyword)) ||
                        user.bio.toLowerCase().includes(keyword)
                    );
                }
                
                // 更新显示的用户
                displayedUsers = filteredUsers;
                
                // 重新渲染列表
                renderUserList(displayedUsers);
                
                // 更新结果计数
                resultsCount.textContent = `找到 ${displayedUsers.length} 位符合条件的用户`;
                
                hideLoading();
            }, 500);
        }
        
        // 渲染用户列表
        function renderUserList(users) {
            // 清空现有列表（保留加载更多按钮）
            const loadMore = document.getElementById("loadMore");
            if (loadMore) {
                friendsList.removeChild(loadMore);
            }
            
            // 如果没有结果，显示空状态
            if (users.length === 0) {
                friendsList.innerHTML = `
                    <div class="empty-state">
                        <i class="fas fa-search"></i>
                        <p>没有找到符合条件的用户</p>
                        <p style="font-size: 0.85rem;">尝试调整筛选条件或搜索其他关键词</p>
                    </div>
                `;
                return;
            }
            
            // 添加用户项
            users.forEach(user => {
                const userElement = createUserElement(user);
                friendsList.appendChild(userElement);
            });
            
            // 添加加载更多按钮
            friendsList.appendChild(loadMoreBtn);
        }
        
        // 创建用户元素
        function createUserElement(user) {
            const userElement = document.createElement("div");
            
            // 确定用户项样式（有无图片）
            let hasImages = user.images && user.images.length > 0;
            userElement.className = `friend-item ${!hasImages ? 'no-images' : ''}`;
            
            // 构建兴趣标签HTML
            let interestsHtml = "";
            user.interests.forEach(interest => {
                interestsHtml += `<span class="interest-tag">${interest}</span>`;
            });
            
            // 构建图片HTML
            let imagesHtml = "";
            if (hasImages) {
                imagesHtml = `<div class="images-container">`;
                
                // 最多显示3张图片
                const displayImages = user.images.slice(0, 3);
                
                displayImages.forEach((img, index) => {
                    imagesHtml += `
                        <div class="image-item">
                            <img src="${img}" alt="${user.name}分享的图片">
                        </div>
                    `;
                });
                
                // 补充空白项以保持网格布局
                for (let i = displayImages.length; i < 3; i++) {
                    imagesHtml += `<div class="image-item" style="display: none;"></div>`;
                }
                
                imagesHtml += `</div>`;
            }
            
            // 在线状态指示器
            const onlineIndicator = user.online ? `<div class="online-indicator"></div>` : "";
            
            // 组装用户项HTML
            userElement.innerHTML = `
                <div class="friend-content">
                    <div class="avatar-container">
                        <div class="user-avatar">
                            <img src="${user.avatar}" alt="${user.name}的头像">
                        </div>
                        ${onlineIndicator}
                    </div>
                    <div class="user-info">
                        <div class="user-name">
                            ${user.name}
                            <span class="user-age">${user.age}岁</span>
                        </div>
                        <div class="user-location">
                            <i class="fas fa-map-marker-alt"></i>
                            <span>${user.location}</span>
                        </div>
                        <div class="user-interests">
                            ${interestsHtml}
                        </div>
                        <div class="user-bio">
                            ${user.bio}
                        </div>
                        ${!hasImages ? `
                            <div class="interaction-buttons">
                                <button class="interact-btn message-btn">
                                    <i class="fas fa-comment"></i>
                                    <span>聊天</span>
                                </button>
                                <button class="interact-btn like-btn">
                                    <i class="far fa-heart"></i>
                                </button>
                            </div>
                        ` : ''}
                    </div>
                </div>
                ${hasImages ? `
                    ${imagesHtml}
                    <div class="friend-content" style="padding-top: 0; padding-bottom: 16px;">
                        <div class="user-avatar" style="visibility: hidden;"></div>
                        <div class="user-info">
                            <div class="interaction-buttons">
                                <button class="interact-btn message-btn">
                                    <i class="fas fa-comment"></i>
                                    <span>聊天</span>
                                </button>
                                <button class="interact-btn like-btn">
                                    <i class="far fa-heart"></i>
                                </button>
                            </div>
                        </div>
                    </div>
                ` : ''}
            `;
            
            return userElement;
        }
        
        // 更新活跃筛选标签显示
        function updateActiveFiltersDisplay() {
            // 清除现有标签（保留"清除全部"按钮）
            const clearBtn = document.querySelector(".clear-all-filters");
            Array.from(activeFiltersContainer.children).forEach(child => {
                if (child !== clearBtn) {
                    activeFiltersContainer.removeChild(child);
                }
            });
            
            // 收集要显示的筛选条件
            const filtersToShow = [];
            
            if (currentFilters.quickFilter !== "全部") {
                filtersToShow.push(currentFilters.quickFilter);
            }
            
            if (currentFilters.category !== "全部兴趣") {
                filtersToShow.push(currentFilters.category);
            }
            
            if (currentFilters.age !== "全部") {
                filtersToShow.push(currentFilters.age);
            }
            
            if (currentFilters.distance !== 20) {
                filtersToShow.push(`${currentFilters.distance}公里内`);
            }
            
            if (currentFilters.gender !== "不限") {
                filtersToShow.push(currentFilters.gender);
            }
            
            if (currentFilters.activity !== "全部") {
                filtersToShow.push(`${currentFilters.activity}活跃`);
            }
            
            if (currentFilters.personality.length > 0) {
                filtersToShow.push(...currentFilters.personality);
            }
            
            if (currentFilters.hasPhotos !== "不限") {
                filtersToShow.push(currentFilters.hasPhotos);
            }
            
            if (currentFilters.search) {
                filtersToShow.push(`搜索: ${currentFilters.search}`);
            }
            
            // 添加筛选标签
            filtersToShow.forEach(filterText => {
                const filterTag = document.createElement("div");
                filterTag.className = "active-filter-tag";
                filterTag.innerHTML = `
                    <span>${filterText}</span>
                    <button class="remove-filter">
                        <i class="fas fa-times"></i>
                    </button>
                `;
                activeFiltersContainer.insertBefore(filterTag, clearBtn);
            });
            
            // 显示或隐藏"清除全部"按钮
            if (filtersToShow.length > 0) {
                clearBtn.style.display = "block";
            } else {
                clearBtn.style.display = "none";
            }
        }
        
        // 清除所有筛选条件
        function clearAllFiltersHandler() {
            // 重置快速筛选按钮
            quickFilterBtns.forEach(btn => btn.classList.remove("active"));
            quickFilterBtns[0].classList.add("active");
            
            // 重置兴趣分类标签
            categoryTags.forEach(tag => tag.classList.remove("active"));
            categoryTags[0].classList.add("active");
            
            // 重置高级筛选面板
            document.querySelectorAll(".filter-section").forEach(section => {
                const options = section.querySelectorAll(".filter-option");
                options.forEach(opt => opt.classList.remove("active"));
                options[0].classList.add("active");
            });
            
            // 重置距离滑块
            distanceSlider.value = 20;
            distanceValue.textContent = "20公里";
            
            // 重置搜索框
            searchInput.value = "";
            
            // 重置筛选条件对象
            Object.keys(currentFilters).forEach(key => {
                switch(key) {
                    case "quickFilter":
                        currentFilters[key] = "全部";
                        break;
                    case "category":
                        currentFilters[key] = "全部兴趣";
                        break;
                    case "age":
                        currentFilters[key] = "全部";
                        break;
                    case "distance":
                        currentFilters[key] = 20;
                        break;
                    case "gender":
                        currentFilters[key] = "不限";
                        break;
                    case "activity":
                        currentFilters[key] = "全部";
                        break;
                    case "personality":
                        currentFilters[key] = [];
                        break;
                    case "hasPhotos":
                        currentFilters[key] = "不限";
                        break;
                    case "search":
                        currentFilters[key] = "";
                        break;
                }
            });
            
            // 应用筛选
            applyAllFilters();
            
            // 清空活跃筛选标签
            const clearBtn = document.querySelector(".clear-all-filters");
            Array.from(activeFiltersContainer.children).forEach(child => {
                if (child !== clearBtn) {
                    activeFiltersContainer.removeChild(child);
                }
            });
            
            // 隐藏"清除全部"按钮
            clearBtn.style.display = "none";
        }
        
        // 移除单个筛选条件
        function removeFilter(filterText) {
            // 快速筛选
            if (quickFilterBtns.forEach(btn => {
                if (btn.querySelector("span").textContent === filterText) {
                    btn.classList.remove("active");
                    quickFilterBtns[0].classList.add("active");
                    currentFilters.quickFilter = "全部";
                    return true;
                }
            })) return;
            
            // 兴趣分类
            if (categoryTags.forEach(tag => {
                if (tag.querySelector("span").textContent === filterText) {
                    tag.classList.remove("active");
                    categoryTags[0].classList.add("active");
                    currentFilters.category = "全部兴趣";
                    return true;
                }
            })) return;
            
            // 年龄范围
            if (filterText.includes("岁")) {
                currentFilters.age = "全部";
                document.querySelectorAll(".filter-section")[0].querySelectorAll(".filter-option")
                    .forEach(opt => opt.classList.remove("active"));
                document.querySelectorAll(".filter-section")[0].querySelector(".filter-option:first-child")
                    .classList.add("active");
                return;
            }
            
            // 距离范围
            if (filterText.includes("公里内")) {
                const distance = parseInt(filterText);
                if (distance === currentFilters.distance) {
                    currentFilters.distance = 20;
                    distanceSlider.value = 20;
                    distanceValue.textContent = "20公里";
                }
                return;
            }
            
            // 性别
            if (filterText === "男" || filterText === "女") {
                currentFilters.gender = "不限";
                document.querySelectorAll(".filter-section")[2].querySelectorAll(".filter-option")
                    .forEach(opt => opt.classList.remove("active"));
                document.querySelectorAll(".filter-section")[2].querySelector(".filter-option:first-child")
                    .classList.add("active");
                return;
            }
            
            // 活跃时间
            if (filterText.includes("活跃")) {
                const activity = filterText.replace("活跃", "");
                if (activity === currentFilters.activity) {
                    currentFilters.activity = "全部";
                    document.querySelectorAll(".filter-section")[3].querySelectorAll(".filter-option")
                        .forEach(opt => opt.classList.remove("active"));
                    document.querySelectorAll(".filter-section")[3].querySelector(".filter-option:first-child")
                        .classList.add("active");
                }
                return;
            }
            
            // 个性标签
            const tagIndex = currentFilters.personality.indexOf(filterText);
            if (tagIndex !== -1) {
                currentFilters.personality.splice(tagIndex, 1);
                // 更新面板中的对应选项
                document.querySelectorAll(".filter-section")[4].querySelectorAll(".filter-option")
                    .forEach(opt => {
                        if (opt.textContent === filterText) {
                            opt.classList.remove("active");
                        }
                    });
                return;
            }
            
            // 照片筛选
            if (filterText.includes("照片")) {
                currentFilters.hasPhotos = "不限";
                document.querySelectorAll(".filter-section")[5].querySelectorAll(".filter-option")
                    .forEach(opt => opt.classList.remove("active"));
                document.querySelectorAll(".filter-section")[5].querySelector(".filter-option:first-child")
                    .classList.add("active");
                return;
            }
            
            // 搜索内容
            if (filterText.startsWith("搜索: ")) {
                currentFilters.search = "";
                searchInput.value = "";
                return;
            }
        }
        
        // 加载更多用户
        function loadMoreUsers() {
            showLoading();
            
            // 模拟加载延迟
            setTimeout(() => {
                // 这里可以从服务器加载更多用户
                // 简单复制现有用户模拟新数据
                const moreUsers = allUsers.map(user => ({
                    ...user,
                    id: user.id + 100, // 确保ID唯一
                    name: `${user.name} (更多)`,
                    distance: user.distance + 10 // 模拟更远的距离
                }));
                
                // 添加到显示列表
                displayedUsers = [...displayedUsers, ...moreUsers];
                
                // 重新渲染
                renderUserList(displayedUsers);
                
                // 更新结果计数
                resultsCount.textContent = `找到 ${displayedUsers.length} 位符合条件的用户`;
                
                hideLoading();
            }, 1000);
        }
        
        // 显示加载状态
        function showLoading() {
            loadMoreBtn.innerHTML = '<i class="fas fa-spinner fa-spin"></i> 加载中...';
            loadMoreBtn.style.pointerEvents = "none";
        }
        
        // 隐藏加载状态
        function hideLoading() {
            loadMoreBtn.innerHTML = "加载更多";
            loadMoreBtn.style.pointerEvents = "auto";
        }
        
        // 显示提示消息
        function showToast(message) {
            // 检查是否已有toast，有则移除
            const existingToast = document.querySelector(".toast-message");
            if (existingToast) {
                existingToast.remove();
            }
            
            // 创建新toast
            const toast = document.createElement("div");
            toast.className = "toast-message";
            toast.style.position = "fixed";
            toast.style.bottom = "80px";
            toast.style.left = "50%";
            toast.style.transform = "translateX(-50%)";
            toast.style.backgroundColor = "rgba(0, 0, 0, 0.7)";
            toast.style.color = "white";
            toast.style.padding = "8px 16px";
            toast.style.borderRadius = "4px";
            toast.style.fontSize = "0.9rem";
            toast.style.zIndex = "9999";
            toast.textContent = message;
            
            // 添加到页面
            document.body.appendChild(toast);
            
            // 3秒后移除
            setTimeout(() => {
                toast.style.opacity = "0";
                toast.style.transition = "opacity 0.3s ease";
                setTimeout(() => {
                    toast.remove();
                }, 300);
            }, 3000);
        }
        
        // 初始化页面
        document.addEventListener("DOMContentLoaded", init);
    </script>
</body>
</html>
